package jdbc_test2;
import java.sql.*;

import util.DBUtil;
public class useDBUtil {
    public static void main(String[] args){
    	demo();
    }
    static void demo(){
    	Connection conn=null;
    	Statement stm=null;
    	ResultSet rs=null;
    	
    	try {
        	conn=DBUtil.getconn();
			stm=conn.createStatement();
	    	rs=stm.executeQuery("select * from userinfo");
	    	while(rs.next()){
	    		System.out.print(rs.getObject(1)+" ");
	    		System.out.print(rs.getObject(2)+" ");
	    		System.out.print(rs.getObject(3)+" ");
	    		System.out.println(rs.getObject(4)+" ");

	    	}

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			
		}finally{
			DBUtil.close(rs, stm, conn);
		}
    	
    }
}
